import {createAPI,createParamsAPI,createUploadAPI,createFormAPI} from '@/utils/http'

export const commentListSearch = data => createParamsAPI(`/comment/search`, 'post', data)  // 查询评论列表
export const getCommentDetail = data => createParamsAPI(`/comment/detail/${data.id}`, 'post', data)  // 查询详情
export const getRootCommentDetail = data => createParamsAPI(`/comment/root/${data.id}`, 'post', data)  // 查询详情
export const saveComment = data => createAPI(`/comment/save`, 'post', data)  // 添加
export const updateComment = data => createAPI(`/comment/update`, 'put', data)  // 修改
export const deleteComment = data => createAPI(`/comment/delete/${data.id}`, 'delete', data)  // 删除


//点赞情况

//根据comment获取点赞情况 是否点赞
export const getCommentLikeByCommentId = data => createAPI(`/comment/like/byComment/${data.commentId}`, 'post', data)
//点赞/取消
export const clickCommentLikeByCommentId = data => createAPI(`/comment/like/byComment/${data.commentId}`, 'put', data)

//发私信
export const sendMail = data => createAPI(`/comment/mail/save`, 'post', data)
export const getMailList = data => createParamsAPI(`/comment/mail/search`, 'post', data)
export const deleteMail = data => createAPI(`/comment/mail/delete/${data.id}`, 'delete', data)
export const readMail = data => createParamsAPI(`/comment/mail/read`, 'post', data)

//new
export const newCommentCountList = data => createParamsAPI(`/comment/isNew`, 'post', data)
export const flagRead = data => createParamsAPI(`/comment/read`, 'post', data)
